iface_name=`cat config/lan_setup.conf | awk '{ print $2 }'`
ip_address=`cat config/lan_setup.conf | awk '{ print $3 }'`

cd src
#make clean

kern_version=`uname -r`
echo "Your kernel version is : $kern_version"
v1=$(echo $kern_version | sed -e 's![^0-9]\+! & !g' -e 's![\.\-]!!g')
echo $v1
set -- $v1; v1comp=$2; v2comp=$3; shift; v1=$*


if [ $v1comp -lt "6" -o $v1comp -eq "6" -a $v2comp -lt "24" ]; then
        echo "Seems like you are having an older kernel  - version (2.$v1comp.$v2comp). Setting compilation flag to NEW_KERNEL=0"
        NEW_KERNEL_TRUE=0
else
        echo "Seems like you are having a new kernel  - version (2.$v1comp.$v2comp). Setting compilation flag to NEW_KERNEL=1"
        NEW_KERNEL_TRUE=1
fi

echo "Now compiling MyMANET source repository....."
sleep 2

make NEW_KERNEL=$NEW_KERNEL_TRUE MYMANET_ALPHA=$MYMANET_ALPHA MYMANET_BETA=$MYMANET_BETA
echo "Compilation successful.!!"

echo "Now inserting MyMANET module in the Kernel...."
sleep 2

insmod manifold.ko device_name=$iface_name
echo "MyMANET module has been inserted in the kernel"


cd ..
